package com.sgcc.pda.mdrh.zoom.router;

import android.content.Context;

import com.google.gson.Gson;
import com.cepri.service.AIDLUtils;
import com.sgcc.pda.hzaidl.entity.RequestBean;
import com.sgcc.pda.model.basic.request.AddApnRequest;
import com.sgcc.pda.model.basic.request.SetDateTimeRequest;

/**
 * Created by cj on 2019/12/2.
 * 掌机基础功能router
 */
public class BasicRouter extends BaseOperateRouter {


    @Override
    public String handleResult(Context context, RequestBean requestBean, CompleteListener completeListener) {
        try {

            String methodName = requestBean.getMethodName();
            switch (methodName) {
                //设置掌机时间
                case "setDateTime":
                    SetDateTimeRequest setDateTimeRequest = new Gson().fromJson(requestBean.getParamJson(), SetDateTimeRequest.class);
                    boolean b = AIDLUtils.setDateTime(setDateTimeRequest.getDateTime());
                    return "" + b;
                case "addApn":
                    AddApnRequest AddApnRequest = new Gson().fromJson(requestBean.getParamJson(), com.sgcc.pda.model.basic.request.AddApnRequest.class);
                    boolean addApnResult = AIDLUtils.addApn(AddApnRequest.getApnName(), AddApnRequest.getApn(), AddApnRequest.getUserName(), AddApnRequest.getPassword());
                    return "" + addApnResult;
                case "getDeviceModel":
                    String deviceModel = AIDLUtils.getDeviceModel();
                    return deviceModel;
                case "getDeviceSn":
                    return AIDLUtils.getDeviceSn();
                case "getOSVersion":
                    return AIDLUtils.getOSVersion();
                case "getDeviceHardVersion":
                    return AIDLUtils.getDeviceHardVersion();
                case "getProductionDate":
                    return AIDLUtils.getProductionDate();
                default:
                    break;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }


}
